<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>打开BPM</title>
</head>
<body onload="URLloading();">
	<script type="text/javascript">
		var upWindow = window.parent.frames["zwIframe"];
		if (!upWindow) {
			try {
				upWindow = window.parent.frames["componentDiv"].frames["zwIframe"];
			} catch (e) {
				upWindow = null;
			}
		}
		var designClass = "design_class", hideClass = "hide_class", browseClass = "browse_class", addClass = "add_class", editClass = "edit_class";
		function getUpFieldsByFieldval(name) {
			return upWindow.$("[fieldval*='displayName:\"" + name + "\"']");
		}
		function getUpFieldValueByName(name, index) {
			return getUpFieldValue(getUpFieldsByFieldval(name).eq(
					index ? index : 0));
		}

		function getUpFieldValue(field) {
			var fieldVal = field.attr("fieldVal");
			var editTag = field.hasClass(editClass);
			var browseTag = field.hasClass(browseClass);
			var addTag = field.hasClass(addClass);
			if (fieldVal != null && typeof (fieldVal) != 'undefined') {
				fieldVal = eval("(" + fieldVal + ")");
			} else {
				return null;
			}
			var obj = new Object();
			obj.displayName = fieldVal.displayName;
			obj.name = fieldVal.name;
			var tag = true;
			switch (fieldVal.inputType) {
			case "text":
			case "textarea":

				if (editTag) {
					obj.value = field.find("#" + fieldVal.name).val();
				} else if (browseTag) {
					obj.value = fieldVal.value;
				} else if (addTag) {
					obj.value = field.find("#" + fieldVal.name).val();
				}
				break;
			case "checkbox":
				if (editTag) {
					obj.value = field.find("#" + fieldVal.name).val();
				} else if (browseTag) {
					obj.value = field.find("#" + fieldVal.name).val();
				}
				break;
			case "radio":
				if (editTag) {
					obj.value = field.find(":radio:checked").attr("val4cal");
				} else if (browseTag) {
					obj.value = field.find(":radio:checked").attr("val4cal");
				}
				break;
			case "select":
				if (editTag) {
					obj.value = field.find(
							"#" + fieldVal.name + " option:selected").attr(
							"val4cal");
				} else if (browseTag) {
					obj.value = field.find("#" + fieldVal.name).attr("val4cal");
				}
				break;
			case "date":
				if (editTag) {
					obj.value = field.find("#" + fieldVal.name).val();
					if (obj.value != "") {
						obj.value = obj.value + " 00:00";
					}
				} else if (browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "datetime":
				if (editTag) {
					obj.value = field.find("#" + fieldVal.name).val();
				} else if (browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "flowdealoption":
				if (editTag) {
					obj.value = fieldVal.value;
				} else if (browseTag) {
					obj.value = fieldVal.value;
				} else if (addTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "lable":
				if (editTag) {
					obj.value = fieldVal.value;
				} else if (browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "relationform":
				if (editTag) {
					obj.value = fieldVal.value;
				} else if (browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "relation":
				if (editTag || browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "project":
				if (editTag) {
					obj.value = field.find("#" + fieldVal.name).val();
				} else if (browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "member":
			case "multimember":
			case "account":
			case "multiaccount":
			case "department":
			case "multidepartment":
			case "post":
			case "multipost":
			case "level":
			case "multilevel":
				if (editTag) {
					obj.value = field.find("#" + fieldVal.name + "_txt").val();
					obj.id = field.find("#" + fieldVal.name).val().split('|')[1];
				} else if (browseTag) {
					obj.value = field.find("#" + fieldVal.name).text();
				}
				break;
			case "attachment":
			case "image":
			case "document":
				if (editTag || browseTag) {
					var attNames = "";
					var tempField = field.find("#" + fieldVal.name);
					var tempFileId = "";
					if (tempField[0].tagName.toLowerCase() == "input") {
						tempFileId = tempField.val();
					} else if (tempField[0].tagName.toLowerCase() == "span") {
						tempFileId = tempField[0].innerHTML;
					}
					var atts = upWindow.getAttBySubreference(tempFileId);
					for (var j = 0; j < atts.length; j++) {
						attNames += atts[j].filename + ",";
					}
					if (attNames != "") {
						attNames = attNames.substr(0, attNames.length - 1);
					}
					obj.value = attNames;
				}
				break;
			case "outwrite":
				if (editTag || browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "externalwrite-ahead":
				if (editTag || browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "exchangetask":
				if (editTag || browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			case "querytask":
				if (editTag || browseTag) {
					obj.value = fieldVal.value;
				}
				break;
			default:
				tag = false;
			}
			if (obj.value != undefined) {
				obj.value = obj.value.replace("\r\n", ";");
				obj.value = obj.value.replace("\n", ";");
			}
			return obj;
		}

		function fy_dialog_close() {
			window.parent.$(".mask").remove();
			window.parent.parent.$(".layui-layer-iframe").parent().find(".layui-layer-close").trigger("click");
		}

		function URLloading() {
			//EB07E1EC46FD4656A4BD75BA2EAA78C9
			var detials = getUpFieldValueByName("竞价包详情页1");
			var detials2 = getUpFieldValueByName("年降详情界面");
			   if(detials!=null){
			   		detials = getUpFieldValueByName("竞价包详情页1").value;
			  		var url="http://bpm.fy.local:9080/dynamicui/?UIID=E58BBA13A0F14BD0A0C833FA2AB31B84&CYCLE_ID="+detials;
					document.getElementById("ifr").src=url; 
			  }else if(detials2!=null){
			detials2 = getUpFieldValueByName("年降详情界面").value;
			var url2 = "http://bpm.fy.local:9080/dynamicui/?UIID=9727BF5EDBC44A38B18F5C28E9F23863&MASTER_NO="
					+ detials2;
			document.getElementById("ifr").src = url2;
			   }

		}
		// 计算页面的实际高度，iframe自适应会用到  
		function calcPageHeight(doc) {
			var cHeight = Math.max(doc.body.clientHeight,
					doc.documentElement.clientHeight);
			var sHeight = Math.max(doc.body.scrollHeight,
					doc.documentElement.scrollHeight);
			var height = Math.max(cHeight, sHeight);
			return height;
		}
/* 		//根据ID获取iframe对象  
		var ifr = document.getElementById("ifr");
		ifr.onload = function() {
			//解决打开高度太高的页面后再打开高度较小页面滚动条不收缩  
			ifr.style.height = '0px';
			var iDoc = ifr.contentDocument || ifr.document;
			var height = calcPageHeight(iDoc);
			if (height < 850) {
				height = 850;
			}
			ifr.style.height = height + 'px';
		} */
	</script>
	<iframe id="ifr" name="ifr" frameborder='0' src=""
		style="min-height:800px;width:100%;height:100%;" scrolling=yes></iframe>

</body>
</html>

